<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="d3-tip.css">
    
</head>
<body>
    <text dominant-baseline=""></text>
    <script src="d3.min.js"></script>
    <!-- <script src="https://d3js.org/d3.v7.min.js"></script> -->
    <script src="d3-tip.js"></script>
    <script>
        const width = 800 ;
        const height = 800 ;
        const margin = 50 ;

        const svg = d3.select('body').append('svg');
        svg.attr('width',width);
        svg.attr('height',height);
        svg.style('border','2px solid #ccc');

        // let data ;
        // let root ;
        // (async function(){
        //      data = await d3.json('china_province_city.json',function(){
        //         console.log(arguments);
        //     })

        //     root = d3.hierarchy(data,d=>d.area);
        // })();

        let data ;
        let root ;
        (async function(){
             data = await d3.json('china_province_city2.json',function(d){
                console.log("d",d);
            })

            const s = d3.stratify()
                .id(d=>d.name)
                .parentId(d=>d.areaName)
            root = s(data)    
        })();

        

    </script>
</body>
</html>